package com.hzdl.car.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.car.bean.Car;
import com.hzdl.car.bean.Role;
import com.hzdl.car.mapper.RentMapper;
import com.hzdl.car.service.RentService;
import com.hzdl.car.vo.CarVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RentServiceImpl implements RentService {

     @Autowired
     private RentMapper rm;
    @Override
    public PageInfo findByWhere(CarVo carVo) {
        PageHelper.startPage(carVo.getPage(),carVo.getLimit());
        List<Car> cList = rm.findByWhere(carVo);
        PageInfo pageInfo = new PageInfo(cList);
        return pageInfo;
    }

    @Override
    public int insertCar(CarVo carVo) {
        return rm.insertCar(carVo);
    }

    @Override
    public int updateCar(CarVo carVo) {
        return rm.updateCar(carVo);
    }

    @Override
    public int deleteByCarNumber(String carNumber) {
        return rm.deleteByCarNumber(carNumber);
    }
}
